xlswrite()

Read(1792) Label: excel object, save, file,

Description:

Write data of an Excel file object to a new Excel file.

Syntax:

f.xlswrite(xo,p)

Note:

The function writes data of an Excel file object to file f. It is used to write data retrieved from an Excel file object in the non-@r@w method.

Parameter:

f

The Excel file object into which data will be written.

xo

The Excel object from which data is retrieved in the non-@r@w method.

p

For specifying the password to access an Excel file.

Example:

Write data of an Excel object to a new Excel file:

 

A

 

1

=file("E1.xls").xlsopen()

Retrieve data from E1.xls and return an Excel object.

2

=file("T2.xls").xlswrite(A1,"123")

Write data of A1’s Excel object to T2.xls and set 123 as the new file’s password.

 

Perform update on Excel object and save the changes:

 

A

 

1

=file("E3.xlsx")

 

2

=A1.xlsopen()

Retrieve data from E3.xlsx and return an Excel object.

3

=demo.query("select * from scores")

Return a table sequence.

4

=A2.xlsexport@t(A3)

Write data of A3’s table sequence to the first sheet of E3.xlsx.

5

=A2.xlsmove ("Sheet3")

Delete a sheet named Sheet3 from E3.xlsx.

6

=A1.xlswrite(A2)

Save updates on the Excel object to a new Excel file.

7

>A2.xlsclose()

Close the Excel object.